1. Technology Field
The present invention generally relates to a block management method, and more particularly, to a block management method for managing physical blocks of a rewritable non-volatile memory, and a memory controller and a memory storage apparatus using the same.
2. Description of Related Art
Along with the widespread of digital cameras, cell phones, and MP3 in recently years, the consumers' demand to storage media has increased drastically. Rewritable non-volatile memory is one of the most adaptable storage media to portable electronic products (for example, notebook computers) due to its many characteristics such as data non-volatility, low power consumption, small volume, non-mechanical structure, and fast access speed. A solid state drive (SSD) is a storage apparatus which uses a flash memory as its storage medium. Thereby, the flash memory industry has become a very important part of the electronic industry in recent years.
A sub memory module of a flash memory module has a plurality of physical blocks, and each of the physical blocks has a plurality of physical pages, wherein data has to be written into a physical block according to the sequence of the physical pages. In addition, a physical page containing data has to be erased before it is used for writing data again. Particularly, because physical block is the smallest unit for erasing data while physical page is the smallest unit for programming (i.e., writing) data, in the management of a flash memory module, the physical blocks are grouped into a replacement area, a data area, and a free area.
The physical blocks in the replacement area are used for replacing damaged physical blocks. To be specific, when a physical block in the data area is damaged, a memory management circuit of the storage apparatus gets a normal physical block from the replacement area to replace the bad physical block. In particular, if there is no more normal physical block in the replacement area for replacing the bad physical block, the storage apparatus is announced as being in a write-protect mode and cannot be used for storing data anymore.
The physical blocks in the data area have been used for storing data from a host system, and the physical blocks in the free area are used for substituting the physical blocks in the data area. Thus, the physical blocks in the free area are blank or available blocks (i.e., no data is recorded therein or data recorded therein is marked as invalid data). Namely, the physical pages in the physical blocks of the data area and the free area are alternatively mapped to the logical pages in the logical blocks to store data from the host system. For example, when a host system is about to write data into a specific logical page in a specific logical block of a storage apparatus, the memory management circuit of the storage apparatus gets a physical block from the free area as a substitute physical block, writes the data into a physical page in the substitute physical block, and records that the data of the logical page is stored in the physical page. Besides, the physical page that is originally mapped to the logical page in the data area is marked as invalid.
Particularly, if the number of available physical blocks in the free area is smaller than a predetermined threshold, the memory management circuit perfolins a data merging procedure. To be specific, in the data merging procedure, the memory management circuit gets a blank physical block from the free area and copies valid data in the substitute physical block and valid data in the corresponding physical block in the data area to the gotten blank physical block, so that the substitute physical block and the corresponding physical block in the data area can be erased and associated with the free area. However, the time for executing a write command is prolonged due to the data merging procedure performed by the memory management circuit. Thereby, how to effectively manage physical blocks to improve the access efficiency of a storage apparatus has become a major subject in the industry.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.